// delivery.js

const covers = [
  'https://pic.ibaotu.com/00/32/39/31Z888piCntA.jpg-0.jpg',
  'https://pic.ibaotu.com/00/31/18/08B888piCvWC.jpg-0.jpg',
  'https://pic.ibaotu.com/00/32/21/28F888piC3Xn.jpg-0.jpg',
  'https://pic.ibaotu.com/00/25/63/10I888piCVbt.jpg-0.jpg',
  'https://pic.ibaotu.com/00/16/87/00f888piC6ha.jpg-0.jpg',
  'https://pic.ibaotu.com/00/28/44/83c888piC4TH.jpg-0.jpg',
  'https://pic.ibaotu.com/00/27/32/56E888piCCzi.jpg-0.jpg',
  'https://pic.ibaotu.com/00/28/73/93f888piChFz.jpg-0.jpg',
  'https://pic.ibaotu.com/00/25/91/67H888piCyQu.jpg-0.jpg'
]

Page({

  /**
   * 页面的初始数据
   */
  data: {
    coverstyle: 'rotateimage',
    html: '',
    visible: false,
    ticketId: null
  },
  onSuccessCall: function({detail: { ticketId }}) {
    const state = { ticketId }
    this.setData(state)
  },
  bindCoverTap: function() {
    this.setData({
      coverstyle: this.data.coverstyle === 'image' ? 'rotateimage' : 'image'
    })
  },
  ticketButtonTap: function() {
    const state = { visible: true }
    this.setData(state)
  },
  onLoad: function (options) {
    let html = "<div>"
    covers.map(c => {
      html = `${html}<img src="${c}" style="height: 340px" />`
    })
    html = `${html}</div>`

    setTimeout(() => {
      const state = { covers, html }
      this.setData(state)
    }, 1000)
  },

  onReady: function () {
  
  },

  onShow: function () {
  
  },
  onHide: function () {
  
  },
  onUnload: function () {
  
  },
  onPullDownRefresh: function () {
  
  },
  onReachBottom: function () {
  
  },
  onShareAppMessage: function () {
  
  }
})